var ObjectId = require('mongodb').ObjectID;
var mongoose = require('./MongooseDB');
var ModelBase = require('./modelBase');

function TagInfo(ti) {
    if(ti != null)
    {
        this._id = ti._id;
        this.meta = ti.meta;
        this.name = ti.name;
        this.description = ti.description;
    }
    else
    {
        this._id = new ObjectId();
        this.meta = "";
        this.name = "";
        this.description = "";
    }
    return this;
}

TagInfo.__proto__ = ModelBase;
TagInfo.modelName = 'TagInfo';
module.exports = TagInfo;

TagInfo.BindCollection = function(collection){
    var TagInfoSchema = new mongoose.Schema({
        _id : ObjectId,
        meta : String,
        name : String
    }, {collection : collection});

    var TagInfoModel = mongoose.model(collection, TagInfoSchema);
    TagInfo.baseModel = TagInfoModel;
}